#include <windows.h> 
#include <wininet.h> 
#include <stdio.h> 

void main() 
{ 	
	HINTERNET hInternet, hHttp;
	HINTERNET hReq;
	DWORD Size;

	TCHAR buf[65000];
	TCHAR buf2[65000] = {0,};
	DWORD dwRead;

	hInternet = InternetOpen("HTTPTEST", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
	if(hInternet == NULL) return;

	hHttp = InternetConnect(hInternet, "icu.w3pad.com", 0, NULL, NULL, INTERNET_SERVICE_HTTP, 0,0);
	if(hHttp == NULL) return;
	
	/*LPCSTR xml;
	xml = "/pages?_method=POST&content=TEST";
	hReq = HttpOpenRequest(hHttp, "GET", xml, NULL, NULL, NULL, 0, 0);*/
	//hReq = HttpOpenRequest(hHttp, "POST", "/pages/TEST", NULL, NULL, NULL, 0, 0);
	//hReq = HttpOpenRequest(hHttp, "GET", "/pages/?format=xml", NULL, NULL, NULL, 0, 0);
	//hReq = HttpOpenRequest(hHttp, "PUT", "/pages/TEST?content=abcdef", NULL, NULL, NULL, 0, 0);
	hReq = HttpOpenRequest(hHttp, "DELETE", "/pages/TEST?format=xml", NULL, NULL, NULL, 0, 0);
	
	HttpAddRequestHeaders(hReq, TEXT("Sabal-Application-Key: app_key_for_icu"), -1L, 0);
	HttpSendRequest(hReq, NULL, 0, NULL, 0);
	
	do{
		InternetQueryDataAvailable(hReq, &Size, 0, 0);
		InternetReadFile(hReq, buf, Size, &dwRead);
		buf[dwRead] = 0;
		lstrcat(buf2, buf);
	}while(dwRead!=0);

	printf(buf2);

	InternetCloseHandle(hHttp);
	InternetCloseHandle(hInternet);
	hHttp = NULL;
	hInternet = NULL;
	
} 